package zju.lzy.controller;

import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import zju.lzy.dto.ResponseMessage;
import zju.lzy.dto.StatDTO;
import zju.lzy.mapper.DeviceMapper;
import zju.lzy.mapper.MessageMapper;
import zju.lzy.mapper.StatMapper;
import zju.lzy.service.stat.StatService;

import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * @author lzy
 */
@RestController
public class StatController {


    @Autowired
    private StatService statService;

    @GetMapping("/stats")
    ResponseMessage getStats(Integer cnt, Integer granularity) {
        List<StatDTO> stats = statService.getStatWithGranularity(cnt, granularity);
        return ResponseMessage.success("设备统计信息查询成功", stats);
    }


}
